package com.pivotal.cloud.security.password;

/**
 * @className: NoopPasswordEncoder
 * @projectName: PivotalCloud项目
 * @module: PivotalCloud项目-NoopPasswordEncoder类，主要位于Security安全模块-Noop模式密码加密模块
 * @content: NoopPasswordEncoder-Noop模式密码加密
 * @author: Powered by Marklin
 * @datetime: 2025-06-24 13:38
 * @version: 1.0.0
 * @copyright: Copyright © 2018-2025 PivotalCloud Systems Incorporated. All rights
 * reserved.
 */
public class NoopPasswordEncoder implements PasswordEncoder {

	/**
	 * 实例化对象
	 */
	private static final PasswordEncoder INSTANCE = NoopPasswordEncoder.newInstance();

	/**
	 * 获取实例
	 * @return 返回结果
	 */
	public static PasswordEncoder getInstance() {
		return INSTANCE;
	}

	/**
	 * 实例化对象
	 * @return 返回结果
	 */
	public static PasswordEncoder newInstance() {
		return new NoopPasswordEncoder();
	}

	/**
	 * 密码加密
	 * @param rawPassword 原始密码
	 * @return 返回结果
	 */
	@Override
	public String encode(CharSequence rawPassword) {
		return rawPassword.toString();
	}

	/**
	 * 验证密码
	 * @param rawPassword 原始密码
	 * @param encodedPassword 加密密码
	 * @return 返回结果
	 */
	@Override
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		return rawPassword.toString().equals(encodedPassword);
	}

}
